<%@ page language="java" import="java.util.*, com.zjut.an.util.tools.*, com.zjut.an.admin.manager.*, com.zjut.an.admin.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" type="text/css" href="../plugins/layuiadmin/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
	<script src="js/city.js"></script>
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<%
if (session.getAttribute("admin") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='AnAdminLogin.html';</script>");
	out.close();
	return;
} 
AnAdmin admin = (AnAdmin)session.getAttribute("admin");
AnAdminManager amanager = (AnAdminManager) SpringContextUtil.getBean("AnAdminManager");
int adId = Integer.parseInt(request.getParameter("adId"));
AnAdmin obj = amanager.getData(adId);
%>
<form class="layui-form layui-from-pane" action="/addCollector" style="margin-top:20px" method="post">
  <div class="layui-form-item">
  	<div class="layui-inline">
	    <label class="layui-form-label">账号</label>
	    <div class="layui-input-block">
	      <input type="text" name="account" autocomplete="off" placeholder="请输入账号" class="layui-input" value="<%=obj.getAccount() %>" readonly>
	    </div>
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">密码</label>
    <div class="layui-input-block">
      <input type="password" name="password" placeholder="请输入密码" lay-verify="required|pass|password" class="layui-input" value="<%=obj.getPassword() %>">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">重复密码</label>
    <div class="layui-input-block">
      <input type="password" name="password2" placeholder="请输入密码" lay-verify="required"  class="layui-input" value="<%=obj.getPassword() %>">
    </div>
  </div> 
  
  <div class="layui-form-item">
    <div class="layui-input-block">
        <input type="text" name="adId" class="layui-input" value="<%=obj.getAdId() %>" style="display:none;">
        <input type="text" name="truename" class="layui-input" value="<%=obj.getTruename() %>" style="display:none;">
		<input type="text" name="lastlogin" value="<%=obj.getLastlogin()%>" style="display:none;">
		<input type="text" name="roId" value="<%=obj.getRoId() %>" style="display:none;">
		<input type="text" name="phone" value="<%=obj.getPhone() %>" style="display:none;">
		<input type="text" name="mobile" value="<%=obj.getMobile() %>" style="display:none;">
		<input type="text" name="active" value="<%=obj.getActive() %>" style="display:none;">
      <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
 
          
<script src="../plugins/layuiadmin/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
var $;
layui.use(['jquery'], function(){ 
   $ = layui.$;
});
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
//自定义验证规则
	form.verify({
		pass: [/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[@$!%*?&^#~])([a-zA-Z0-9@$!%*?&^#~]{8,20})$/, '密码必须8到32位的数字字母特殊字符组合'],
	    password: function(value){
	      if($('input[name=password2]').val() !== value){
          return '两次密码输入不一致！';
	      }
	    }
	});
  
  
  //监听提交
  form.on('submit(demo1)', function(data){
    var rowStr = data.field;
    $.ajax({
      	type:"post",
      	url:"../anAdminUpdate.action",
      	data:{
      		rowstr:JSON.stringify(rowStr)
      	},
      	async:true,
      	cache:false,
      	success:function(res){
      		layer.msg('提交成功');
      	}
      });
    return false;
  });
  
});
</script>
</body>
</html>